Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: SwiftUI custom redact #4392

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

ref: SwiftUI custom redact #4392

wants to merge 19 commits into from

Conversation

brustolin
Copy link
Contributor

@brustolin brustolin commented Oct 2, 2024

📜 Description

Added sentryReplayUnmask as SwiftUI modifier.

💚 How did you test it?

Sample tests

📝 Checklist

You have to check all boxes before merging:

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 67.50000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 91.442%. Comparing base (2f5e5f7) to head (5bc4277).

Files with missing lines Patch % Lines
Sources/SentrySwiftUI/SentryReplayView.swift 30.000% 7 Missing ⚠️
Sources/Swift/Tools/UIRedactBuilder.swift 75.000% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4392       +/-   ##
=============================================
- Coverage   91.443%   91.442%   -0.002%     
=============================================
  Files          629       629               
  Lines        50630     50656       +26     
  Branches     18344     18371       +27     
=============================================
+ Hits         46298     46321       +23     
- Misses        4238      4243        +5     
+ Partials        94        92        -2     
Files with missing lines Coverage Δ
Sources/Swift/Extensions/UIViewExtensions.swift 100.000% <ø> (ø)
Sources/Swift/Tools/SentryViewPhotographer.swift 92.000% <100.000%> (ø)
...entryTests/SwiftUI/SentryRedactModifierTests.swift 100.000% <100.000%> (ø)
Sources/Swift/Tools/UIRedactBuilder.swift 92.424% <75.000%> (-4.067%) ⬇️
Sources/SentrySwiftUI/SentryReplayView.swift 28.571% <30.000%> (+8.571%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f5e5f7...5bc4277. Read the comment docs.

}
}

@objcMembers
class SentryRedactViewHelper: NSObject {
public class SentryRedactViewHelper: NSObject {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not super happy about making this class public, but SentrySwiftUI is an external module that needs access to it. Also, it’s impossible to misuse it in a way that would cause a crash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you added some new methods. Maybe you can create an extra SentryRedactViewHelper just for SentrySwiftUI so you don't need to make it public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not possible, I need to read it from RedactBuilder class that needs to be in the Sentry SDK.
Maybe if we split SR into a different module already we would need to worry less about this being public

Copy link

github-actions bot commented Oct 2, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1229.53 ms 1248.48 ms 18.95 ms
Size 21.58 KiB 730.06 KiB 708.48 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1bf8571 1250.96 ms 1255.36 ms 4.40 ms
2ccbd03 1225.13 ms 1247.51 ms 22.39 ms
d011484 1220.86 ms 1237.18 ms 16.33 ms
6001822 1220.82 ms 1245.02 ms 24.20 ms
3723833 1205.22 ms 1216.94 ms 11.71 ms
ff09c7e 1240.94 ms 1262.66 ms 21.72 ms
b9d59f7 1250.71 ms 1257.78 ms 7.06 ms
94d8eb3 1234.02 ms 1249.63 ms 15.60 ms
e773cad 1219.86 ms 1238.26 ms 18.40 ms
90d17d3 1261.18 ms 1278.18 ms 17.00 ms

App size

Revision Plain With Sentry Diff
1bf8571 20.76 KiB 437.12 KiB 416.36 KiB
2ccbd03 21.58 KiB 546.20 KiB 524.62 KiB
d011484 21.58 KiB 616.14 KiB 594.56 KiB
6001822 22.85 KiB 410.98 KiB 388.13 KiB
3723833 21.58 KiB 424.34 KiB 402.76 KiB
ff09c7e 20.76 KiB 427.76 KiB 407.00 KiB
b9d59f7 22.85 KiB 405.77 KiB 382.93 KiB
94d8eb3 21.58 KiB 417.86 KiB 396.28 KiB
e773cad 21.58 KiB 681.75 KiB 660.17 KiB
90d17d3 20.76 KiB 432.17 KiB 411.41 KiB

Previous results on branch: feat/SwiftUI-unmask

Startup times

Revision Plain With Sentry Diff
4d3f509 1205.52 ms 1247.10 ms 41.58 ms

App size

Revision Plain With Sentry Diff
4d3f509 21.58 KiB 737.91 KiB 716.32 KiB

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with one small comment.

}
}

@objcMembers
class SentryRedactViewHelper: NSObject {
public class SentryRedactViewHelper: NSObject {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you added some new methods. Maybe you can create an extra SentryRedactViewHelper just for SentrySwiftUI so you don't need to make it public?

Sources/Swift/Tools/UIRedactBuilder.swift Show resolved Hide resolved
Base automatically changed from feat/SwiftSR-Unmask to main October 4, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants